﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FactoryAndStrategy
{
    public class DeductionContext
    {
        /// <summary>
        /// 扣款策略
        /// </summary>
        private IDeduction _deduction = null;

        /// <summary>
        /// 構造函數傳遞策略
        /// </summary>
        /// <param name="deduction"></param>
        public DeductionContext(IDeduction deduction)
        {
            this._deduction = deduction;
        }

        /// <summary>
        /// 執行扣款
        /// </summary>
        /// <param name="card"></param>
        /// <param name="trade"></param>
        /// <returns></returns>
        public bool exec(Card card, Trade trade)
        {
            return this._deduction.exec(card, trade);
        }
    }
}
